package com.myjianzhu.zzt88.exercise.java.algorithm;

public class SwapTest {
    public static void main(String[] args) {
        swapMethod1();
        swapMethod2();
    }

    private static void swapMethod1() {
        int a = 3;
        int b = 100;
        a = a ^ b;
        b = a ^ b;
        a = a ^ b;
        System.out.println("swapMethod 1 result a = " + a + " b=" + b);
    }

    private static void swapMethod2() {
        int a = 3;
        int b = 100;
        a = a + b;
        b = a - b;
        a = a - b;
        System.out.println("swapMethod 2 result a = " + a + " b=" + b);
    }

}
